{% extends "main/index.html" %}

{% load i18n %}
{% block title %}
<title>{% trans "Documents" %}</title>
{% endblock %}
{% block content %}
    <div class="titulo_contenedor">
    {% trans "Search Documents" %}
    </div>
    <div class="cuerpo_contenedor">
        <p>{% trans "Use this form to search for documents. You can search by doc number." %}</p>
        <form action="/documents/search/" method="post">
            <label for="search_doc">{% trans "Document Number" %}</label>
            <input type="text" name="search_doc" id="search_doc"/>
            <input type="submit" value="Search" class="boton_1"/>
        </form>
        <form action="/documents/list_docs/" method="post">
            <input type="submit" value="List All" class="boton_1"/>
        </form>
        <br/>
        <br/>
        <hr/>
        <br/>
        {% if result and found %}
			<table>
				<tr>
					<th>{% trans "Document Number" %}</th>
					<th>{% trans "Owner" %}</th>
					<th>{% trans "Date" %}</th>
					<!--<th>{% trans "Role" %}</th>-->
				</tr>
				<tr>
					<td><a>{{ docNum }}</a></td>
					<td><a>{{ owner }}</a></td>
					<td><a>{{ date }}</a></td>
				</tr>
			</table>
			<br/>
		{% if  is_owner %}
		<form action="/documents/edit_document/" method="post" name="docNum">
			<td><a href="/documents/edit_document/{{docNum}}">{% trans "Go to the doc editing form."%}</a></td>
		</form>
		{% endif %}
		<form action="/documents/view_document" method="post">
			<td><a href="/documents/view_document/{{docNum}}/comments" >{% trans "Go to the view document form." %}</a></td>
		</form>

		{% else %}
			{% if ret %}
				<form action="/documents/search/" method="post">
					<td><a href="/documents/search">{% trans "Document nos found, try again." %}</a></td>
				</form>
			{% endif %}
		{% endif %}

    </div>
    <div class="fondo_contenedor">
    </div>
{% endblock %}
